package lambda;

import java.util.Comparator;
import java.util.TreeSet;
import java.util.function.Supplier;

public class ConstructionMethodReference {
    public static void main(String[] args) {
        // 生产函数式接口
        Supplier<Student> supplier1 = new Supplier<Student>() {
            @Override
            public Student get() {
                return new Student();
            }
        };
        System.out.println(supplier1.get());

        Supplier<Student> supplier2 =  () -> new Student();
        System.out.println(supplier2.get());

        Supplier<Student> supplier3 = Student::new;
        System.out.println(supplier3.get());


        MySupplier<String,Integer,Student> mySupplier = Student::new;
        System.out.println(mySupplier.get("王五", 15));
    }
}

@FunctionalInterface
interface MySupplier<E1,E2,T> {
    T get(E1 e1,E2 e2);
}